// Package storeproduct
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2024 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.7
package storeproduct

import (
	"hotgo/internal/model/input/form"

	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/util/gmeta"
)

// ListReq 查询商品列表
type ListReq struct {
	g.Meta `path:"/product/list" method:"get" tags:"商品" summary:"获取商品列表"`
	form.PageReq
}
type StoreProduct struct {
	Id           int64  `json:"id"           description:"主键id"`
	Title        string `json:"title"        description:"商品标题"`
	Subtitle     string `json:"subtitle"     description:"商品子标题"`
	Code         string `json:"code"         description:"商品编码"`
	ShareContent string `json:"shareContent" description:"分享文案"`
	Image        string `json:"image"        description:"商品主图"`
	Price        int    `json:"price"        description:"售价（分）"`
	Stock        uint   `json:"stock"        description:"库存"`
	Limit        int    `json:"limit"        description:"限购，0表示不限购"`
	FakeSale     uint   `json:"sale"     description:"虚拟销量"`
	IsHot        int    `json:"isHot"        description:""`
	Status       int    `json:"status"       description:"上架状态：0=未上架，1=已上架"`
	Sort         int    `json:"sort"         description:"排序"`
	StatusText   string `json:"statusText"`
	PriceText    string `json:"priceText"`
	StockText    string `json:"stockText"`
	SaleText     string `json:"saleText"`
}
type ListRes struct {
	form.PageRes
	List []StoreProduct `json:"list"   dc:"数据列表"`
}

// ViewReq 获取商品指定信息
type ViewReq struct {
	g.Meta `path:"/product/view" method:"get" tags:"商品" summary:"获取商品指定信息"`
	Id     uint64 `json:"id" v:"required#商品ID不能为空" dc:"商品ID"`
}
type StoreProductAttr struct {
	gmeta.Meta `orm:"table:hg_store_product_attr"`
	Id         int64  `json:"id" dc:"主键id"`
	ProductId  int64  `json:"product_id" dc:"商品id"`
	Name       string `json:"name"     dc:"属性名称"`
	Value      string `json:"value"    dc:"属性值"`
}
type StoreProductContent struct {
	gmeta.Meta `orm:"table:hg_store_product_content"`
	Id         int64  `json:"id" dc:"主键id"`
	ProductId  int64  `json:"product_id" dc:"商品id"`
	Content    string `json:"content"    dc:"图文"`
}
type StoreProductImage struct {
	gmeta.Meta `orm:"table:hg_store_product_image"`
	Id         int64  `json:"id" dc:"主键id"`
	ProductId  int64  `json:"product_id" dc:"商品id"`
	Image      string `json:"image"    dc:"图片"`
}
type StoreProductSku struct {
	gmeta.Meta `orm:"table:hg_store_product_sku"`
	Id         int64  `json:"id" dc:"主键id"`
	ProductId  int64  `json:"product_id" dc:"商品id"`
	Name       string `json:"name"     dc:"规格名称"`
	Price      string `json:"price"    dc:"价格"`
	Stock      string `json:"stock"    dc:"库存"`
	Code       string `json:"code"    dc:"编码"`
}
type StoreProductInfo struct {
	StoreProduct
	Skus    []*StoreProductSku   `json:"product_skus" dc:"规格列表" orm:"with:product_id=id"`
	Images  []*StoreProductImage `json:"product_images" dc:"图片列表" orm:"with:product_id=id"`
	Attrs   []*StoreProductAttr  `json:"product_attrs" dc:"属性列表" orm:"with:product_id=id"`
	Content *StoreProductContent `json:"content" dc:"商品详情" orm:"with:product_id=id"`
}
type ViewRes struct {
	Data StoreProductInfo `json:"data"`
}
